#include "TCPSocket.h"



CTCPSocket::CTCPSocket()
{
}


CTCPSocket::CTCPSocket(const CTCPSocket &__instance)
{
}


CTCPSocket& CTCPSocket::operator = (const CTCPSocket &__instance)
{
    return *this;
}


int CTCPSocket::Send(const std::string strMSG)
{
    return SOCKET_TCP_SEND(m_nSocket_fd, strMSG.c_str(), (int)strMSG.size(), 0);
}


int CTCPSocket::Recv(std::string &strMSG)
{
    char cBuff[NETDEBUG_BUFF_SIZE];
    memset(cBuff, 0, NETDEBUG_BUFF_SIZE);
    int nRet = SOCKET_TCP_RECV(m_nSocket_fd, cBuff, NETDEBUG_BUFF_SIZE, 0);
    if(0 <= nRet)
    {
        strMSG = cBuff;
    }
    return nRet;
}


CTCPSocket* CTCPSocket::CreateClientConnection(SOCKET nSocket, struct sockaddr_in addrHost)
{
    CTCPSocket* SockClient = new CTCPSocket();
    SockClient->m_nSocket_fd = nSocket;
    SockClient->m_addrHost = addrHost;
    return SockClient;
}